<?php

use think\facade\Route;

//应用的路由文件需要返回函数，函数内部实现可完全参考tp6的路由定义规则
//所有的请求：包含get、post等都需要定义路由

$addon = get_addon_name(__FILE__, 2);
$namespace = "\addons\\$addon";

return function () use ($addon, $namespace){
    $admin_namespace = $namespace . "\admin\controller\\";

    Route::group("$addon/admin/database", function () use ($admin_namespace) {
        $controller = $admin_namespace . "Database::";
        Route::rule('index', $controller . "index");
        Route::rule('optimize', $controller . "optimize");

        Route::rule('tabledelpost', $controller . "tabledelpost");
        Route::rule('tableedit', $controller . "tableedit");
        Route::rule('tableadd', $controller . "tableadd");
        Route::rule('tables', $controller . "tables");

        Route::rule('columndelpost', $controller . "columndelpost");
        Route::rule('columnsavepost', $controller . "columnsavepost");
        Route::rule('columnedit', $controller . "columnedit");
        Route::rule('columnadd', $controller . "columnadd");
        Route::rule('columns', $controller . "columns");

        Route::rule('indexdelpost', $controller . "indexdelpost");
        Route::rule('indexsavepost', $controller . "indexsavepost");
        Route::rule('indexedit', $controller . "indexedit");
        Route::rule('indexadd', $controller . "indexadd");
        Route::rule('indexs', $controller . "indexs");
    });

    Route::group("$addon/admin/index", function () use ($admin_namespace) {
        $controller = $admin_namespace . "Index::";
        Route::rule('welcome', $controller . "welcome");
        Route::rule('index', $controller . "index");
    });
};